package com.yutel.multher.reaper.domain;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

public class QueueList<T extends TaskData> {
	private BlockingQueue<T> list;

	public QueueList(int max) {
		list = new LinkedBlockingQueue<T>(max);
	}

	public boolean addAll(List<T> l) {
		return list.addAll(l);
	}

	public List<T> getAll() {
		List<T> remain = new ArrayList<T>();
		list.drainTo(remain);
		return remain;
	}

	public boolean offer(T tdp) {
		return list.offer(tdp);
	}

	public T poll() {
		return list.poll();
	}

	public int size() {
		return list.size();
	}
}
